<template>
    <div>
        <h1>注册页面</h1>
        <p>用户名：<input type="text" v-model="username"></p>
        <p>密码：<input type="text" v-model="password"></p>
        <p>确认密码：<input type="text" v-model="password2"></p>
        <p>权限：<input type="text" v-model="qx"></p>
        <p><button @click="add">注册</button></p>
    </div>
</template>

<script>
import axios from 'axios'
export default {
    data() {
        return {
            base_url:'http://127.0.0.1:8000',
            username:'',
            password:'',
            password2:'',
            qx:0,
        }
    },
    methods: {
        add() {
            let fdata=new FormData()
            fdata.append('username',this.username)
            fdata.append('password',this.password)
            fdata.append('password2',this.password2)
            fdata.append('qx',this.qx)
            axios({
                url:this.base_url+'/app02/register/',
                method:'post',
                data:fdata
            }).then(resp=>{
                console.log(resp.data)
            })
        },
    },
    created() {

    }
}
</script>

<style scoped>

</style>
